package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.JournalBean;
import com.project.bean.SaleCarBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ISaleCarMapper extends BaseMapper<SaleCarBean> {

    @Select("SELECT SUM(tp.`g_sellPrice`*ts.`s_num`) FROM t_saleCar ts,t_goods tp WHERE " +
            "ts.`fk_goodsId`= tp.`g_number` AND ts.`fk_userId` = #{userId}")
    @ResultType(Integer.class)
    public Integer getTotalPrice(Integer userId);

    public List<SaleCarBean> findUserId(Integer userId);

    public SaleCarBean findById(@Param("goodsId") Integer goodsId,@Param("userId") Integer userId);
}
